Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increased Json MaxDepth to 128 #1649

Merged
merged 1 commit into from
Dec 8, 2023
Merged

Conversation

johannesmols
Copy link
Contributor

Using NSwag on schemas with large depths causes an exception to be thrown due to the MaxDepth default setting of 64. I am not aware of any way of customizing the Json settings for parsing the schema in a project when using NSwag, as it invokes the precompiled DLL directly. More context here: RicoSuter/NSwag#4394. #1565 is also related, but can be solved by modifying the settings in the project.

I'm not sure if it is the best approach to just change the default setting in this project to solve it. There doesn't seem to be a way of passing in a JsonSerializerSettings object or func to modify it in FromJsonAsync (called from here in NSwag). If there was such an option, the default wouldn't have to be modified here but it could be changed in NSwag where the issue is relevant.

@johannesmols
Copy link
Contributor Author

Apparently the unit tests are failing due to an old URL in a test, and is not related to this change. I made a new PR to fix this in #1651.

Copy link
Collaborator

@lahma lahma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like reasonable increment to me, considering it was unlimited before.

@johannesmols
Copy link
Contributor Author

Perfect. Perhaps it can then be released with the upcoming v11.

@johannesmols
Copy link
Contributor Author

@lahma Any chance of merging this? I'm still having the issue of not being able to generate clients with NSwag, and it would be nice to have it included in a future release to resolve this.

@lahma
Copy link
Collaborator

lahma commented Dec 8, 2023

We are waiting for Rico as he does the final call...

@RicoSuter RicoSuter merged commit 3585d60 into RicoSuter:master Dec 8, 2023
2 of 4 checks passed
@RicoSuter
Copy link
Owner

I think this is fine... we should not expose Newtonsoft.Json serializer internals as eventually NJS and NSwag will switch to STJ for schema serialization and this option would then go away anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants